<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改班级信息')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-class-edit" th:object="${class}">
            <input name="classId" th:field="*{classId}" type="hidden">
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">班级名称：</label>
                    <div class="col-sm-8">
                        <input name="className" th:field="*{className}" class="form-control" type="text" required>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">年级：</label>
                    <div class="col-sm-8">
                        <input name="grade" th:field="*{grade}" class="form-control" type="text" required>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">所属院系：</label>
                    <div class="col-sm-8">
<!--                        <input name="collegeId" th:field="*{collegeId}" class="form-control" type="text" required>-->
                        <select name="collegeId" class="form-control">
                            <option th:each="college:${colleges}" th:value="${college.collegeId}" th:text="${college.collegeName}" th:selected="${college.collegeId == class.collegeId}"></option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">专业：</label>
                    <div class="col-sm-8">
<!--                        <input name="majorId" th:field="*{majorId}" class="form-control" type="text" required>-->
                        <select name="majorId" class="form-control">
                            <option th:each="major:${majors}" th:value="${major.majorId}" th:text="${major.majorName}" th:selected="${major.majorId == class.majorId}"></option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">学生人数：</label>
                    <div class="col-sm-8">
                        <input name="studentCount" th:field="*{studentCount}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">是否有效：</label>
                    <div class="col-sm-8">
                        <select name="isActive" class="form-control" th:with="type=${@dict.getType('sys_active_status')}">
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{isActive}"></option>
                        </select>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "college/class";
        $("#form-class-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-class-edit').serialize());
            }
        }
    </script>
</body>
</html>